package com.guigu.ababa.ababaclassroom.config;

import com.guigu.ababa.ababaclassroom.util.StoreFactory;
import com.guigu.ababa.ababaclassroom.util.StoreInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Appconfig {

    @Bean
    public StoreFactory storeFactory(){
        StoreFactory storeFactory=new StoreFactory();
        return storeFactory;
    }

    @Bean
    public StoreInterface storeInterface(@Value("${luban.storeType}") String storeType, @Autowired StoreFactory storeFactory){
        return storeFactory.getStore(storeType);
    }
}
